package com.linian.pushforcampus.service.Impl;


import com.linian.pushforcampus.domain.Vip;
import com.linian.pushforcampus.mapper.VipMapper;
import com.linian.pushforcampus.service.VipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Time;
import java.util.Date;
import java.util.List;

// VipServiceImpl.java

@Service
public class VipServiceImpl implements VipService {
    @Autowired
    private VipMapper vipMapper;


    @Override
    public void insertVip(Vip vip) {
        vip.setCreateTime(new Date());
        vip.setUpdateTime(new Date());
        vipMapper.insertVip(vip);
    }

    @Override
    public Vip getVipById(int id) {
        return vipMapper.getVipById(id);
    }

    @Override
    public List<Vip> getAllVips() {
        return vipMapper.getAllVips();
    }
    @Override
    public List<Vip> getAllVipsForLike(String userId) {
        return vipMapper.getAllVipsForLike(userId);
    }

    @Override
    public List<Vip> getAllVipsByStates() {
        return vipMapper.getAllVipsByStates();
    }

    @Override
    public void updateVip(Vip vip) {
        vip.setUpdateTime(new Date());
        vipMapper.updateVip(vip);
    }

    @Override
    public void deleteVip(int id) {
        vipMapper.deleteVip(id);
    }

    @Override
    public Vip getVipByUserIdFromUserID(String userId) {
        return vipMapper.getVipByUserIdFromUserID(userId);
    }

    @Override
    public List<Vip> getVipSurvive() {
        return vipMapper.getVipSurvive();
    }

}
